<?php //Obtiene el listado de Sub-Tramos 
	session_start();
	
	include("security/config.php");
	$link = pg_connect("user=".$_SESSION['usuario']." port=".DB_PORT." dbname=".DB_NAME." host=".DB_HOST." password=".$_SESSION['pass']);
		
	try
	{
		$sql = "SELECT 0 id_sub_tramo, 'General' sub_tramo UNION ALL SELECT id_sub_tramo, sub_tramo from sub_tramo order by 1;";
		
		$result = pg_exec($link, $sql);
		
		$arr = array();
		
		If (!$result) {
			pg_close($link);
			Echo '{success:false}'.$sql;
		}
		else
		{
			while($obj = pg_fetch_object($result)){
				$arr[] = $obj;
			}
			pg_close($link);
			Echo '{success:true,data:'.json_encode($arr).'}';		
		}
	}catch(Exception $e)
	{
		pg_close($link);
		echo '{success:false}';
	}
?>
